class MyExcept(Exception):
    def __init__(self,msg) -> None:
        super().__init__()
        self.msg   = msg
    
    def __str__(self) -> str:
        return self.msg    


def name_input():
    name = input("请输入姓名")
    name = name.strip()  #去空格
    if name =="":
        raise MyExcept("姓名不能为空")
    elif len(name)>4 :
        raise MyExcept("姓名长度不能超过4")
    
    for ele in name:
        if ele.isdigit():
            raise MyExcept("不能包含数字")
    return name



while True:
    name = name_input()
    print(name)
